package com.tanhua.server.controller;

import com.tanhua.server.pojo.User;
import com.tanhua.server.utils.UserThreadLocal;


import com.tanhua.server.vo.HuanXinUser;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: Administrator
 * @date: Created in 2021/2/23 16:35
 * @version: 0.0.1
 * @modified By:3
 */
@RestController
@RequestMapping("huanxin")
public class HuanXinController {
    @GetMapping("user")
    public ResponseEntity<HuanXinUser>queryUser(){
        User user= UserThreadLocal.get();
        HuanXinUser huanXinUser=new HuanXinUser();
        huanXinUser.setUsername(user.getId().toString());
        huanXinUser.setPassword(DigestUtils.md5Hex(user.getId()+"_itcast_tanhua"));
        return ResponseEntity.ok(huanXinUser);
    }
}
